package com.dzm.xgb.core.controller.admin;

import com.dzm.common.result.R;
import com.dzm.xgb.core.enums.BorrowerStatusEnum;
import com.dzm.xgb.core.pojo.entity.BorrowInfo;
import com.dzm.xgb.core.pojo.vo.BorrowInfoApprovalVO;
import com.dzm.xgb.core.service.BorrowInfoService;
import com.dzm.xgb.core.service.BorrowerService;
import com.dzm.xgb.core.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 作者：Dzm
 * 时间：2024-09-24-9:31
 * 功能：
 */

@RestController
@RequestMapping("/admin/core/borrowInfo")
public class AdminBorrowInfoController {

    @Autowired
    private BorrowInfoService borrowInfoService;

    /**
     * 获取借款列表
     * @return
     */
    @GetMapping("/list")
    public R list() {
        List<BorrowInfo> list = borrowInfoService.selectList();

        return R.ok().data("list", list);
    }

    /**
     * 获取借款详细信息
     * @param id
     * @return
     */
    @GetMapping("/show/{id}")
    public R show(@PathVariable("id") Integer id) {
        Map<String, Object> result = borrowInfoService.show(id);

        return R.ok().data("borrowInfoDetail", result);
    }

    /**
     * 借款信息审核
     *
     */
    @PostMapping("/approval")
    public R approval(@RequestBody BorrowInfoApprovalVO vo) {
        borrowInfoService.approval(vo);

        return R.ok();
    }
}
